Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional methods to get the target of an audit-log entry #2575

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Almighty-Satan
Copy link
Contributor

Pull Request Etiquette

Changes

  • Internal code
  • Library interface (affecting end-user code)
  • Documentation
  • Other: _____

Closes Issue: NaN

Description

Adds multiple methods to get the target of an AuditLogEntry. This includes methods for auto-mod rules, channels, members, scheduled events and threads.
The integrations field returned by Discord's audit-logs endpoint (https://discord.com/developers/docs/resources/audit-log) is currently being ignored because I don't think JDA has any API for integrations (please correct me if I'm wrong).

@freya022
Copy link
Contributor

I think it should be the user's responsibility to check the target's type.
It would even help in the situation the target is correct, but the entity is still null (due to cache issues for example).

So basically, throw if the target type is incorrect, else return the target.

(Don't forget the dot at the end of your Javadoc descriptions btw)

@Almighty-Satan
Copy link
Contributor Author

I think it should be the user's responsibility to check the target's type. It would even help in the situation the target is correct, but the entity is still null (due to cache issues for example).

So basically, throw if the target type is incorrect, else return the target.

I thought about that, but decided against it because AuditLogEntry#getWebhook (which already exists) also doesn't throw. I'd be open to changing that tho.

(Don't forget the dot at the end of your Javadoc descriptions btw)

I just copied the docs from AuditLogEntry#getWebhook. There are dots missing on other methods in that class too. I'll fix that later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants